package com.lcf.feign.config;

import com.fasterxml.jackson.databind.ObjectMapper;
import feign.Logger;
import feign.codec.Decoder;
import org.springframework.cloud.openfeign.support.ResponseEntityDecoder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 描述：feign配置
 *
 * @author lcf
 * @since 2025/3/4 19:27
 */
@Configuration
public class FeignConfig {
    /**
     * 全局配置
     */
    @Bean
    public Logger.Level feignLoggerLevel() {
        return Logger.Level.FULL;
    }

    /**
     * openfeign业务异常封装
     */
    @Bean
    public Decoder feignDecoder(ObjectMapper objectMapper) {
        return new ResponseEntityDecoder(new FeignDecoder(objectMapper));
    }
}
